package com.btn.service;

import org.springframework.data.domain.Page;

public interface BaseService<T> {
    /**
     * 保存 entity.
     *
     * @param entity the entity
     * @return entity
     */
    public T saveEntity(T entity) throws Exception;

    /**
     * 删除 entity.
     *
     * @param id the id
     */
    public void deleteEntity(Long id);

    /**
     * 批量删除 entities.
     *
     * @param ids the ids
     * @return int int
     */
    public void deleteEntities(String ids);

    /**
     * 更新 entity.
     *
     * @param entity the entity
     */
    public void updateEntity(T entity) throws Exception;

    /**
     * 获取 entity.
     *
     * @param id the id
     * @return entity the entity
     */
    public T getEntity(Long id) throws Exception;

    /**
     * 按条件分页获取
     *
     * @param t entity of parms
     * @param currentPage the current page
     * @param pageSize    the page size
     * @return Page<T>   entities
     */
    public Page<T> getEntitiesByParms(T t, int currentPage, int pageSize);

    /**
     * 总记录数
     *
     * @return int entities count
     */
    public long getEntitiesCount();


}
